/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ua.yandex.mergesort;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Neophron
 * @param <E>
 */
public class Sort<E extends Comparable<E>> {

    public List<E> sort(List<E> toSort) {
        List<E> result = new ArrayList<>(toSort.size());
        for (int i = 0; i < toSort.size(); i++) {
            result.add(null);
        }
        MergeSort t = new MergeSort<>(toSort, 0,
                toSort.size() - 1, result, 0);
        t.run();
        return result;
    }

}
